<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改实有人口')"/>
    <th:block th:include="include :: jasny-bootstrap-css"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-population-edit" th:object="${population}">
        <input name="rkbm" th:field="*{rkbm}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">头像：</label>
            <div class="col-sm-8 fileinput input-group "
                 th:classappend="${photo} ? 'fileinput-exists' : 'fileinput-new'" data-provides="fileinput"
                 style="text-align: center; margin-bottom: 0;">
                <div class="fileinput-preview thumbnail" data-trigger="fileinput"
                     style="width: 200px; height: 150px; margin-right: 10px;">
                    <img th:if="${photo}" th:src="@{'/sys/common/view/' + ${photo}}">
                </div>
                <span class="btn btn-white btn-file"><span class="fileinput-new">选择图片</span><span
                        class="fileinput-exists">更改</span><input name="photo" type="hidden" th:value="${photo}"><input
                        id="williamYe" type="file"></span>
                <a href="#" class="btn btn-white fileinput-exists" data-dismiss="fileinput">清除</a>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">地址名称：</label>
            <div class="col-sm-8">
                <input name="dzmc" th:field="*{dzmc}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">登记类型：</label>
            <div class="col-sm-8">
                <select name="syrkdzzdjlxdm" class="form-control m-b"
                        th:with="type=${@dict.getParamValue('SQJW_RY_DZZDJLX')}" required>
                    <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"
                            th:field="*{syrkdzzdjlxdm}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">管理类别：</label>
            <div class="col-sm-8">
                <select name="syrkgllbdm" class="form-control m-b"
                        th:with="type=${@dict.getParamValue('SQJW_SYRKGLLB')}" required>
                    <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"
                            th:field="*{syrkgllbdm}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">姓名：</label>
            <div class="col-sm-8">
                <input name="xm" th:field="*{xm}" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">外文姓：</label>
            <div class="col-sm-8">
                <input name="wwx" th:field="*{wwx}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">外文名：</label>
            <div class="col-sm-8">
                <input name="wwm" th:field="*{wwm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">身份证：</label>
            <div class="col-sm-8">
                <select name="ywsfzh" class="form-control m-b">
                    <option value="0" th:field="*{ywsfzh}">有</option>
                    <option value="1" th:field="*{ywsfzh}">无</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">公民身份号码：</label>
            <div class="col-sm-8">
                <input name="gmsfhm" th:field="*{gmsfhm}" class="form-control" type="text">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">证件种类：</label>
            <div class="col-sm-8">
                <select name="cyzjdm" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_ZJZL2')}"
                        required>
                    <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"
                            th:field="*{cyzjdm}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">证件号码：</label>
            <div class="col-sm-8">
                <input name="zjhm" th:field="*{zjhm}" class="form-control" type="text">
            </div>
        </div>
        <!-- <div class="form-group">
             <label class="col-sm-3 control-label">是否境外人员：</label>
             <div class="col-sm-8">
                 <input name="sfjwry" th:field="*{sfjwry}" class="form-control" type="text">
             </div>
         </div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">性别：</label>
            <div class="col-sm-8">
                <select name="xbdm" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_XB')}" required>
                    <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"
                            th:field="*{xbdm}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">民族：</label>
            <div class="col-sm-8">
                <select name="mzdm" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_MZ')}">
                    <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"
                            th:field="*{mzdm}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">出生日期：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="csrq" th:value="${#dates.format(population.csrq, 'yyyy-MM-dd')}" class="form-control"
                           placeholder="yyyy-MM-dd" type="text" required>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">人户分离标识：</label>
            <div class="col-sm-8">
                <select name="rhflbz" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_RHFLBS')}">
                    <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"
                            th:field="*{rhflbz}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">联系电话：</label>
            <div class="col-sm-8">
                <input name="lxdh" th:field="*{lxdh}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">户籍地：</label>
            <div class="col-sm-8">
                <input name="hjdDzbm" th:field="*{hjdDzbm}" class="form-control" type="hidden">
                <div class="input-group">
                    <input class="form-control" name="hjd" th:field="*{hjd}" type="text" onclick="selectAddressTree()"
                           id="treeName" readonly="true">
                    <span class="input-group-addon"><i class="fa fa-search"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">标签：</label>
            <div class="col-sm-8">
                <input name="bq" th:value="${bq}" type="hidden">
                <input id="labelName" th:value="${labelNames}" class="form-control" type="text" readonly>
                <div id="tree" class="ztree" style="border: 1px solid #e5e6e7"></div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">重点人员标识：</label>
            <div class="col-sm-8">
                <input name="zdrybz" th:field="*{zdrybz}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">重点人员类别：</label>
            <div class="col-sm-8">
                <input name="zdrylb" th:field="*{zdrylb}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">数据来源：</label>
            <div class="col-sm-8">
                <select name="sjly" class="form-control m-b" th:with="type=${@dict.getParamValue('YBSS_SJLY')}">
                    <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"
                            th:field="*{sjly}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">登记人账号：</label>
            <div class="col-sm-8">
                <input name="djrZh" th:field="*{djrZh}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">登记人姓名：</label>
            <div class="col-sm-8">
                <input name="djrXm" th:field="*{djrXm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">登记时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="djsj" th:value="${#dates.format(population.djsj, 'yyyy-MM-dd')}" class="form-control"
                           placeholder="yyyy-MM-dd" type="text">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">更新账户：</label>
            <div class="col-sm-8">
                <input name="gxrZh" th:field="*{gxrZh}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">更新部门：</label>
            <div class="col-sm-8">
                <input name="gxbm" th:field="*{gxbm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">核录部门：</label>
            <div class="col-sm-8">
                <input name="hlbm" th:field="*{hlbm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">核录时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="hlsj" th:value="${#dates.format(population.hlsj, 'yyyy-MM-dd')}" class="form-control"
                           placeholder="yyyy-MM-dd" type="text">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">核录人：</label>
            <div class="col-sm-8">
                <input name="hlr" th:field="*{hlr}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">核录标识：</label>
            <div class="col-sm-8">
                <select name="hlbz" class="form-control m-b"
                        th:with="type=${@dict.getParamValue('YBSS_HLBZ')}">
                    <option th:each="dict : ${type}" th:text="${dict.itemText}"
                            th:value="${dict.itemValue}"
                            th:field="*{hlbz}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">户号：</label>
            <div class="col-sm-8">
                <input name="hh" th:field="*{hh}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">与户主关系：</label>
            <div class="col-sm-8">
                <select name="yhzgx" class="form-control m-b"
                        th:with="type=${@dict.getParamValue('T_PEO_RELATION')}">
                    <option th:each="dict : ${type}" th:text="${dict.itemText}"
                            th:value="${dict.itemValue}"
                            th:field="*{yhzgx}"></option>
                </select>
            </div>
        </div>
        <!--<div class="form-group">
            <label class="col-sm-3 control-label">是否已申领居住证：</label>
            <div class="col-sm-8">
                <select name="sfysljzz" class="form-control m-b">
                    <option value="Y" th:field="*{sfysljzz}">已申领</option>
                    <option value="N" th:field="*{sfysljzz}">未申领</option>
                </select>
            </div>
        </div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label">是否已申领居住证：</label>
            <div class="col-sm-8">
                <select name="sfysljzz" class="form-control m-b"
                        th:with="type=${@dict.getParamValue('SFZD_DQJC')}">
                    <option th:each="dict : ${type}" th:text="${dict.itemText}"
                            th:value="${dict.itemValue}"
                            th:field="*{sfysljzz}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">境外人员类型：</label>
            <div class="col-sm-8">
                <select name="jwrylx" class="form-control m-b" th:with="type=${@dict.getParamValue('YBSS_JWRYLX')}">
                    <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"
                            th:field="*{jwrylx}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <input name="bz" th:field="*{bz}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">重点人员类别名称：</label>
            <div class="col-sm-8">
                <input name="zdrylbmc" th:field="*{zdrylbmc}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">互联网审核人：</label>
            <div class="col-sm-8">
                <input name="hlwshr" th:field="*{hlwshr}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">互联网审核时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="hlwshsj" th:value="${#dates.format(population.hlwshsj, 'yyyy-MM-dd')}"
                           class="form-control" placeholder="yyyy-MM-dd" type="text">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">内网备注：</label>
            <div class="col-sm-8">
                <input name="nwbz" th:field="*{nwbz}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">户政户籍地：</label>
            <div class="col-sm-8">
                <input name="hzHjd" th:field="*{hzHjd}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">注销时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="zxsj" th:value="${#dates.format(population.zxsj, 'yyyy-MM-dd')}" class="form-control"
                           placeholder="yyyy-MM-dd" type="text">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">注销账号：</label>
            <div class="col-sm-8">
                <input name="zxzh" th:field="*{zxzh}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">注销时间标志：</label>
            <div class="col-sm-8">
                <input name="zxsjbz" th:field="*{zxsjbz}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">审批人：</label>
            <div class="col-sm-8">
                <input name="spr" th:field="*{spr}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">审批时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="spsj" th:value="${#dates.format(population.spsj, 'yyyy-MM-dd')}" class="form-control"
                           placeholder="yyyy-MM-dd" type="text">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">核实结果：</label>
            <div class="col-sm-8">
                <select name="syrkhsjg" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_SFQR')}">
                    <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"
                            th:field="*{syrkhsjg}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">去往地_国家：</label>
            <div class="col-sm-8">
                <input name="qwdGjhdqdm" th:field="*{qwdGjhdqdm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">去往地_省市县：</label>
            <div class="col-sm-8">
                <input name="qwdSsxqdm" th:field="*{qwdSsxqdm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">去往地_区划内详址：</label>
            <div class="col-sm-8">
                <input name="qwdQhnxz" th:field="*{qwdQhnxz}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">国家：</label>
            <div class="col-sm-8">
                <input name="gjhdqdm" th:field="*{gjhdqdm}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">注销原因：</label>
            <div class="col-sm-8">
                <input name="zxyy" th:field="*{zxyy}" class="form-control" type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: jasny-bootstrap-js"/>
<th:block th:include="include :: datetimepicker-js"/>
<script type="text/javascript">
    var prefix = ctx + "control/population";

    $("#form-population-edit").validate({
        focusCleanup: true
    });

    $(function () {
        var url = ctx + "control/label/treeData";
        var options = {
            id: "tree",
            url: url,
            check: {enable: true},
            expandLevel: 0,
            onCheck: onCheck
        };
        $.tree.init(options);
    });

    function onCheck() {
        $('input[name="bq"]').val(getChecked('id'));
        $('#labelName').val(getChecked('name'));
    }

    function getChecked(column) {
        var nodes = $._tree.getCheckedNodes(true);
        return $.map(nodes, function (row) {
            if (!row.isParent) {
                return row[column]
            }
        }).join();
    }

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-population-edit').serialize());
        }
    }

    $('#williamYe').on('change.bs.fileinput ', function (e) {
        // 处理自己的业务
        if (this.files[0]) {
            const formData = new FormData();
            formData.append('file', this.files[0]);
            $.operate.fileUpload(formData, $('input[name="photo"]'));
        } else {
            $('input[name="photo"]').val("");
        }
    });

    /*编辑-选择地址树*/
    function selectAddressTree() {
        var url = prefix + "/selectAddressTree";
        var options = {
            title: '户籍地选择',
            width: "380",
            url: url,
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero) {
        var body = layer.getChildFrame('body', index);
        $('input[name="hjdDzbm"]').val(body.find('#treeId').val());
        $("#treeName").val(body.find('#treeName').val());
        layer.close(index);
    }

    $("input[name='csrq']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='djsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='hlsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='hlwshsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='zxsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='spsj']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
</body>
</html>
